﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace b3
{
    class Program
    {
        static void Main(string[] args)
        {

            ArrayList b=new ArrayList();
            
            for(int i = 2; i <= 100; i++)
            {
                b.Add(i);
            }

            Console.Write("2-100中的素数有:");

            int x = 0;
            int first = 0;


            while (true)
            {
                first = Convert.ToInt32(b[0]);
                for (int i = 1; i < b.Count; i++)
                {
                    if ((Convert.ToInt32(b[i]) % first) == 0)
                    {
                        b.RemoveAt(i);
                        i--;
                    }

                }

                if (first * first > Convert.ToInt32(b[b.Count - 1]))
                {
                    break;
                }
                else
                {
                    if (first == 2)
                    {
                        Console.Write(first);
                    }
                    else
                    {
                        Console.Write("," + first);
                    }
                    b.RemoveAt(0);
                }
            }
            for(int i = 0; i < b.Count; i++)
            {
                Console.Write(","+b[i]);
            }


            Console.ReadLine();


        }
    }
}
